#ifndef HANDLOCALISER_HPP
#define HANDLOCALISER_HPP

#include "faceDetector.h"
#include "abstractProbabilityTransformer.hpp"

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

#define HI_ERR_NOFACEFOUND -22220001
#define HI_ERR_PROBTRANS_NOT_SET -22220002

//TODO : remove unnecessary imports

class HandLocaliser {

public:
	HandLocaliser();
	cv::Rect localiseHand( const cv::Mat& image );
	//MUST CHECK FOR EXCEPTION: HI_ERR_NOFACEFOUND
	cv::Rect localiseFace( const cv::Mat& image );
	
	cv::Ptr< AbstractProbabilityTransformer > getProbabilityTransformer();
	//MUST check for exception: HI_ERR_PROBTRANS_NOT_SET
	//Warning: Currently, probability transformer may still be altered by handlocaliser after it has been returned.
	//NOT threadsafe!
	
	~HandLocaliser();
	
//	class TrackingData {
//	public:
//		AbstractProbabilityTransformer* probTrans;
//		cv::Rect trackingRect;
//	}
	
	
		
protected:
	FaceDetector* faceDetector;
	cv::Ptr< AbstractProbabilityTransformer > probTrans;
	
private:
	cv::Point initialLocationGuess( const cv::Mat& probImage );
	
	//Although these does not need to change, the way the OpenCV library is written
	//makes it difficult to make faceDetector const because of certain functions called inside it?
	
	//TODO : could consider using Ptr instead of raw pointers. Or drop the pointers entirely.
};


	

#endif